/*
 * Copyright © 2011 Breachwalls & Company Inc. and other authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.breachwalls.h2p.platform.persistence.entity;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.breachwalls.h2p.platform.persistence.AbstractEntity;

/**
 * ユーザーエンティティ.
 * @author Ken Todoroki
 * @version $Revision$
 */
@Entity
@Table(name = "M_USER")
public class User extends AbstractEntity {

    private static final long serialVersionUID = 1L;

    @Column(name = "USERNAME", nullable = false, length = 64)
    private String username;

    @Column(name = "PASSWORD", nullable = false, length = 64)
    private String password;

    @Column(name = "ENABLE", nullable = false)
    private Boolean enable = Boolean.TRUE;

    // bi-directional many-to-one association to Permission
    @OneToMany(mappedBy = "user")
    private Set<Permission> permissions;

    public Boolean getEnable() {
        return this.enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Set<Permission> getPermissions() {
        return this.permissions;
    }

    public void setPermissions(Set<Permission> permissions) {
        this.permissions = permissions;
    }

}
